package com.kun.demo01;

//查看JVM堆内存大小
public class TestHeapSize {
    public static void main(String[] args) {
        Long maxMemory = Runtime.getRuntime().maxMemory(); //返回JVM最大可用内存
        long totalMemory = Runtime.getRuntime().totalMemory();//返回JVM总内存


        System.out.println("JVM最大可用内存：" + maxMemory / 1024 / 1024 + "MB"); //单位为MB
        System.out.println("JVM总内存：" + totalMemory / 1024 / 1024 + "MB"); //单位为MB
    }
}
